{% extends 'layout.html' %}
{% load permission %}
{% load static %}
{% load color %}
{% block css %}
    <link rel="stylesheet" href="{% static 'css/search-group.css' %}">
{% endblock %}
{% block content %}
    {% include 'include/search_group.html' %}
    <div style="float: right;margin-bottom: 5px" class="clearfix">
        <form class="form-inline" method="get">
            <div class="form-group">
                <input name="keyword" type="text" class="form-control" placeholder="请输入关键字" value="{{ keyword }}">
            </div>
            <button type="submit" class="btn btn-default">
                <span class="glyphicon glyphicon-search"></span>
            </button>
        </form>
    </div>

    <table class="table table-bordered">
        <thead>
        <tr>
            <th>ID</th>
            <th>类型</th>
            <th>金额</th>
            <th>客户</th>
            <th>订单号</th>
            <th>时间</th>
            <th>其他</th>
        </tr>
        </thead>
        <tbody>
        {% for row in pager.queryset %}
            <tr>
                <td>{{ row.id }}</td>
                <td>
                    <span class="btn btn-xs btn-{{ row.charge_type|color }}">{{ row.get_charge_type_display }}</span>
                </td>
                <td>
                    {% if row.charge_type == 1 %}
                        +{{ row.amount }}
                    {% elif row.charge_type == 2 %}
                        -{{ row.amount }}
                    {% elif row.charge_type == 3 %}
                        -{{ row.amount }}
                    {% elif row.charge_type == 5 %}
                        +{{ row.amount }}
                    {% endif %}
                </td>
                <td>{{ row.customer.username }}</td>
                <td>
                    {% if row.order_oid %}
                        {{ row.order_oid }}
                    {% else %}
                        -
                    {% endif %}
                </td>
                <td>{{ row.create_date | date:"Y-m-d H:i:s" }}</td>
                <td>
                    {% if row.memo %}
                        {{ row.memo }}
                    {% else %}
                        -
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    <ul class="pagination">
        {{ pager.html }}
    </ul>

{% endblock %}

